package de.moc.server;

import java.util.Vector;

import de.moc.shared.*;

public final class PNonPConverter {

	public static Survey SurveyPtoSurvey(SurveyP surveyP) {
		Vector<Choice> choices = new Vector<Choice>();

		for (int i = 0; i < surveyP.getChoices().size(); i++)
			choices.add(new Choice(surveyP.getChoices().get(i).getName(),
					surveyP.getChoices().get(i).getCount()));

		return new Survey(surveyP.getName(), choices, surveyP.getId());
	}

	public static SurveyP SurveytoSurveyP(Survey survey) {
		Vector<ChoiceP> choicesP = new Vector<ChoiceP>();

		for (int i = 0; i < survey.getChoices().size(); i++)
			choicesP.add(new ChoiceP(survey.getChoices().get(i)));

		return new SurveyP(survey.getName(), choicesP, survey.getId());
	}
}
